﻿using System;
using System.Collections.Generic;
using System.Text;
using DataAccess;
using System.Data;
using Entity;

namespace BusinessObject
{
    public class UserBO
    {
        UsersDA usDA = new UsersDA();


        public DataSet getUser(int currPage, int recodperpage, int Pagesize)
        {
            DataSet dt = usDA.getUser(currPage,recodperpage,Pagesize);
            return dt;
        }

        public bool createUser(string userName, string password, int status)
        {
            Users us = new Users();
            us.UserName = userName;
            us.Password = password;
            us.UserStatus = status;
            if (usDA.CreateUser(us))
            {
                return true;
            }
            return false;
        }

        public Users selectUserByName(string name)
        {
            Users us = usDA.getUserByName(name);
            return us;
        }

        public bool updateUser(Users us)
        {
            if (usDA.UpdateUser(us))
            {
                return true;
            }
            return false;
        }

        public bool removeUser(Users us)
        {
            if (usDA.DeleteUser(us))
            {
                return true;
            }
            return false;
        }

        public bool resetPass(Users us)
        {
            if (usDA.ResetPassword(us))
            {
                return true;
            }
            return false;
        }
    }
}
